#include <iostream>
#include <algorithm>
using namespace std;
const int N = 110;
int a[N];
int main() {
    int x;
    cin >> x;
    for (int i = 0; i < x; i++) {
        cin >> a[i];
    }
    sort(a, a + x);
    cout << a[x - 1] - a[0] << endl;
    return 0;
}